package org.come.Jpanel;

import com.tool.btn.FormsOnOffBtn;
import com.tool.btn.GetLiangHaoBtn;
import com.tool.btn.LiangHaoItemBtn;
import com.tool.btn.LiangHaoPaiBtn;
import com.tool.role.RoleData;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;
import org.apache.commons.lang.StringUtils;
import org.come.bean.LoginResult;
import org.come.until.CutButtonImage;

import javax.swing.*;
import java.awt.*;

@SuppressWarnings("serial")
public class PaintLiangHaoJpanel extends JPanel {


    private LiangHaoItemBtn paint1,
            paint2, paint3, paint4;
    private LiangHaoPaiBtn sureBtn;
    private JLabel labOwnXy, labPayXy, text;
    private int selectType = 5;


    public PaintLiangHaoJpanel() {
        String style = MyIsif.getStyle();
if ("水墨UI".equals(style)) {
        this.setPreferredSize(new Dimension(410, 398));
        this.setLayout(null);
        this.setBackground(UIUtils.Color_BACK);
        FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/button/1.png", 1, 705);
        offBtn.setBounds(410 - 35, 10, 25, 25);
        this.add(offBtn);


        paint1 = new LiangHaoItemBtn("inkImg/newbutton/B34.png", 1, this, 50, "水波蓝玉");
        paint1.setColors(UIUtils.COLOR_WHITE);
        this.paint1.setBounds(60, 240, 68, 17);
        this.add(this.paint1);

        paint2 = new LiangHaoItemBtn("inkImg/newbutton/B34.png", 1, this, 51, "青玉红沁");
        paint2.setColors(UIUtils.COLOR_WHITE);
        this.paint2.setBounds(138, 240, 68, 17);
        this.add(this.paint2);

        paint3 = new LiangHaoItemBtn("inkImg/newbutton/B34.png", 1, this, 52, "梅枝白玉");
        paint3.setColors(UIUtils.COLOR_WHITE);
        this.paint3.setBounds(216, 240, 68, 17);
        this.add(this.paint3);

        paint4 = new LiangHaoItemBtn("inkImg/newbutton/B34.png", 1, this, 53, "溢彩流光");
        paint4.setColors(UIUtils.COLOR_WHITE);
        this.paint4.setBounds(294, 240, 68, 17);
        this.add(this.paint4);

        sureBtn = new LiangHaoPaiBtn("inkImg/newbutton/B22.png", 1, "确定染色", 4, this);
        this.sureBtn.setBounds(200, 350, 99, 24);
        this.add(this.sureBtn);

        text = new JLabel();
        text.setBounds(60, 218, 400, 15);
        text.setForeground(Color.BLACK);
        text.setText("<html><font color='black'>染色后</font><font color='red'>开通频道显示</font><font color='black'>可类似土豪金显示</font></html>");
        text.setFont(new Font("宋体",0,13));
        this.add(text);

        labOwnXy = new JLabel();
        labOwnXy.setBounds(180, 316, 120, 15);
        labOwnXy.setForeground(Color.WHITE);
        labOwnXy.setFont(new Font("宋体",0,16));
        this.add(labOwnXy);

        labPayXy = new JLabel();
        labPayXy.setBounds(180, 286, 120, 15);
        labPayXy.setForeground(Color.WHITE);
        labPayXy.setFont(new Font("宋体",0,16));
        labPayXy.setText("3000");//染色消耗积分数量
        this.add(labPayXy);
        } else {
            this.setPreferredSize(new Dimension(410, 398));
            this.setLayout(null);
            this.setBackground(UIUtils.Color_BACK);
            FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/hongmu/gift-close-btn1.png", 1, 705);
            offBtn.setBounds(410 - 35, 10, 25, 25);
            this.add(offBtn);


            paint1 = new LiangHaoItemBtn("inkImg/hongmu/a7.png", 1, this, 50, "水波蓝玉");
            paint1.setColors(UIUtils.COLOR_WHITE);
            this.paint1.setBounds(60, 240, 68, 19);
            this.add(this.paint1);

            paint2 = new LiangHaoItemBtn("inkImg/hongmu/a7.png", 1, this, 51, "青玉红沁");
            paint2.setColors(UIUtils.COLOR_WHITE);
            this.paint2.setBounds(138, 240, 68, 19);
            this.add(this.paint2);

            paint3 = new LiangHaoItemBtn("inkImg/hongmu/a7.png", 1, this, 52, "梅枝白玉");
            paint3.setColors(UIUtils.COLOR_WHITE);
            this.paint3.setBounds(216, 240, 68, 19);
            this.add(this.paint3);

            paint4 = new LiangHaoItemBtn("inkImg/hongmu/a7.png", 1, this, 53, "溢彩流光");
            paint4.setColors(UIUtils.COLOR_WHITE);
            this.paint4.setBounds(294, 240, 68, 19);
            this.add(this.paint4);

            sureBtn = new LiangHaoPaiBtn("inkImg/hongmu/100_26.png", 1, "确定染色", 4, this);
            this.sureBtn.setBounds(175, 339, 99, 24);
            sureBtn.setForeground(Color.WHITE);
//            sureBtn.setFont(new Font("微软雅黑", Font.BOLD, 14));
            this.add(this.sureBtn);

            text = new JLabel();
            text.setBounds(60, 218, 400, 15);
            text.setForeground(Color.BLACK);
            text.setText("<html><font color='white'>染色后</font><font color='red'>开通频道显示</font><font color='white'>可类似土豪金显示</font></html>");
            text.setFont(new Font("宋体",0,13));
            this.add(text);

            labOwnXy = new JLabel();
            labOwnXy.setBounds(180, 316, 120, 15);
            labOwnXy.setForeground(Color.WHITE);
            labOwnXy.setFont(new Font("宋体",0,16));
            this.add(labOwnXy);

            labPayXy = new JLabel();
            labPayXy.setBounds(180, 286, 120, 15);
            labPayXy.setForeground(Color.WHITE);
            labPayXy.setFont(new Font("宋体",0,16));
            labPayXy.setText("3000");
            this.add(labPayXy);
        }
    }

    private ImageIcon iconBack;

    @Override
    protected void paintComponent(Graphics g) {
        String style = MyIsif.getStyle();
if ("水墨UI".equals(style)) {
        super.paintComponent(g);
        if (iconBack == null) {
            iconBack = new ImageIcon("inkImg/newbackground/paintlh.png");
        }
        g.drawImage(iconBack.getImage(), 0, 0, 410, 398, this);
        labOwnXy.setText(String.valueOf(RoleData.getRoleData().getLoginResult().getCodecard().longValue()));
        final LoginResult login = RoleData.getRoleData().getLoginResult();
        String num = login.getLiangHao();
        Integer type = login.getLianghaotype() == null ? 0 : login.getLianghaotype();
        if (StringUtils.isNotEmpty(num)) {
            String[] nums = num.split("");
            for (int j = 0; j < nums.length; j++) {
                int xnum = 175 + (13 * j);
                int ynum = 110;
                g.drawImage(CutButtonImage.getImage("inkImg/number/" + String.valueOf(selectType) + nums[j] + ".png", 12, 16).getImage(), xnum, ynum, 12, 16, this);
            }
        }
    } else {
            super.paintComponent(g);
            if (iconBack == null) {
                iconBack = new ImageIcon("img/xy2uiimg/ransehongmu.png");
            }
            g.drawImage(iconBack.getImage(), 0, 0, 410, 398, this);
            labOwnXy.setText(String.valueOf(RoleData.getRoleData().getLoginResult().getCodecard().longValue()));
            final LoginResult login = RoleData.getRoleData().getLoginResult();
            String num = login.getLiangHao();
            Integer type = login.getLianghaotype() == null ? 0 : login.getLianghaotype();
            if (StringUtils.isNotEmpty(num)) {
                String[] nums = num.split("");
                for (int j = 0; j < nums.length; j++) {
                    int xnum = 175 + (13 * j);
                    int ynum = 110;
                    g.drawImage(CutButtonImage.getImage("inkImg/number/" + String.valueOf(selectType) + nums[j] + ".png", 12, 16).getImage(), xnum, ynum, 12, 16, this);
                }
            }
        }
    }

    public ImageIcon getIconBack() {
        return iconBack;
    }

    public void setIconBack(ImageIcon iconBack) {
        this.iconBack = iconBack;
    }

    public LiangHaoItemBtn getPaint1() {
        return paint1;
    }

    public void setPaint1(LiangHaoItemBtn paint1) {
        this.paint1 = paint1;
    }

    public LiangHaoItemBtn getPaint2() {
        return paint2;
    }

    public void setPaint2(LiangHaoItemBtn paint2) {
        this.paint2 = paint2;
    }

    public LiangHaoItemBtn getPaint3() {
        return paint3;
    }

    public void setPaint3(LiangHaoItemBtn paint3) {
        this.paint3 = paint3;
    }

    public LiangHaoItemBtn getPaint4() {
        return paint4;
    }

    public void setPaint4(LiangHaoItemBtn paint4) {
        this.paint4 = paint4;
    }

    public LiangHaoPaiBtn getSureBtn() {
        return sureBtn;
    }

    public void setSureBtn(LiangHaoPaiBtn sureBtn) {
        this.sureBtn = sureBtn;
    }

    public JLabel getLabOwnXy() {
        return labOwnXy;
    }

    public void setLabOwnXy(JLabel labOwnXy) {
        this.labOwnXy = labOwnXy;
    }

    public JLabel getLabPayXy() {
        return labPayXy;
    }

    public void setLabPayXy(JLabel labPayXy) {
        this.labPayXy = labPayXy;
    }

    public int getSelectType() {
        return selectType;
    }

    public void setSelectType(int selectType) {
        this.selectType = selectType;
    }
}
